import { config, constants } from '@/config/index.js';
const PREFIX = `${constants.SOURCE}_`;

const storage = {
	setItem(key, value) {
		uni.setStorageSync(PREFIX + key, JSON.stringify(value));
	},
	getItem(key) {
		const value = uni.getStorageSync(PREFIX + key);
		return value ? JSON.parse(value) : null;
	},
	removeItem(key) {
		uni.removeStorageSync(PREFIX + key);
	},
	clear() {
		uni.clearStorageSync();
	}
};

export {
	storage
}